﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;

namespace Ones.Models
{
    [Serializable()]

    class User : ISerializable
    {
        public string Username { get; set; }
        public string UserId { get; set; }
        public string AccessToken { get; set; }
        public string SecretToken { get; set; }
        public bool Primary { get; set; }

        public User()
        {
        }

        public User(SerializationInfo info, StreamingContext ctxt)
        {
            Username = (String)info.GetValue("Username", typeof(string));
            UserId = (String)info.GetValue("UserId", typeof(string));
            AccessToken = (String)info.GetValue("AccessToken", typeof(string));
            SecretToken = (String)info.GetValue("SecretToken", typeof(string));
            Primary = (Boolean)info.GetValue("Primary", typeof(bool));
        }
        
        public void GetObjectData(SerializationInfo info, StreamingContext ctxt)
        {
            info.AddValue("Username", Username);
            info.AddValue("UserId", UserId);
            info.AddValue("AccessToken", AccessToken);
            info.AddValue("SecretToken", SecretToken);
            info.AddValue("Primary", Primary);
        }

    }
}
